package org.apache.rocketmq.client;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

/**
 * @Description TODO
 * @Author nya
 * @Date 2021/7/16 上午11:41
 **/
public class TestProducer {


    public static void main(String[] args) throws Exception {
        final DefaultMQProducer producer = new DefaultMQProducer("nya_producer");
        // 设置NameServer地址
        producer.setNamesrvAddr("172.31.65.68:9876");
        producer.start();

        Message userSyncMsg = new Message("stone-user-dd-topic","87878788888888333388".getBytes(StandardCharsets.UTF_8));
        SendResult send = producer.send(userSyncMsg);
        System.out.println("MQ Sync GS Message SendResult:" + send);
    }
}
